/**
 * Created by deng on 16-3-21.
 * 倒计时Ctrl
 */
angular.module('metalabPartnerApp')
    .controller('CountdownCtrl', ['$scope', '$interval', '$state',
        function ($scope, $interval, $state) {

            var toState = $state.params.toState || 'meta.account.info';
            var moduleName = $state.params.moduleName || undefined;
            var moduleId = $state.params.moduleId || undefined;

            if (moduleName && moduleId) {
                var toParams = {};
                toParams[moduleName] = moduleId;
            }

            $scope.moduleName = moduleName;
            $scope.go = function () {
                $state.go('meta.' + moduleName + '.list.released');
            };

            //$scope.count = 3;
            //
            //var countdown = $interval(function () {
            //    $scope.count--;
            //
            //    if ($scope.count === 0) {
            //        $interval.cancel(countdown);
            //        //$state.go(toState, toParams);
            //        $state.go(toState, toParams);
            //    }
            //}, 1000);
            //
            //$scope.$on('$destroy', function () {
            //    $interval.cancel(countdown);
            //});

        }]);

